package com.bookbuf.cardflipanimation.sample;

import android.app.Fragment;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

/**
 * Created by robert on 16/7/6.
 */
public abstract class FragmentSample extends Fragment {

	@Nullable
	@Override
	public View onCreateView (LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {

		TextView textView = new TextView (getActivity ());
		textView.setText (init ());
		textView.setTextSize (30);
		textView.setGravity (Gravity.CENTER);
		textView.setLayoutParams (new ViewGroup.LayoutParams (ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
		textView.setBackgroundColor (color ());
		return textView;
	}

	abstract String init ();

	abstract int color ();

}
